﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Runtime.Serialization;

namespace Content.Web
{
    public partial class Unit
    {
        [DataMember]
        public bool HasBulletDescriptions
        {
            get
            {
                var context = new eLearningEntities();

                return context.BulletPoints.Any(b => b.UnitID == this.UnitID && b.Details != null);
            }
        }

        [DataMember]
        public bool HasBulletImages
        {
            get
            {
                var context = new eLearningEntities();

                return context.BulletPoints.Any(b => b.UnitID == this.UnitID && b.ImageData != null);
            }
        }

        [DataMember]
        public bool HasImage
        {
            get
            {
                return this.ImageData != null;
            }
        }

        [DataMember]
        public bool HasContentRows
        {
            get
            {
                var context = new eLearningEntities();

                return context.ContentRows.Any(r => r.UnitID == this.UnitID);
            }
        }
    }
}